# 定义函数
def calcSum(beg, end):
    sum = 0
    for i in range(beg, end + 1):
        sum += i
    print(sum)
 # 调用函数
sum(1, 100)
sum(300, 400)
sum(1, 1000)
# # 1. 求 1 - 100 的和
# sum = 0
# for i in range(1, 101):
#     sum += i
# print(sum)
# # 2. 求 300 - 400 的和
# sum = 0
# for i in range(300, 401):
#     sum += i
# print(sum)
# # 3. 求 1 - 1000 的和
# sum = 0
# for i in range(1, 1001):
#     sum += i
# print(sum)
# import sys
# import time
# import random
#
# print("+---------------------------------------------------------------------+")
# print("|                                                                     |")
# print("|                      花有重开日,人无再少年                             |")
# print("|                           欢迎来到                                   |")
# print("|                                                                     |")
# print("+---------------------------------------------------------------------+")
# while True:
#     print("请设定初始属性(可用总点数 20)")
#     face = int(input("设定 颜值(1-10):"))
#     strong = int(input("设定 体质(1-10):"))
#     iq = int(input("设定 智力(1-10):"))
#     home = int(input("设定 家境(1-10):"))
#
#     if face < 1 or face > 10:
#         print("颜值设置有误!")
#         continue
#     if strong < 1 or strong > 10:
#         print("体质设置有误!")
#         continue
#     if iq < 1 or iq > 10:
#         print("智力设置有误!")
#         continue
#     if home < 1 or home > 10:
#         print("家境设置有误!")
#         continue
#     if face + strong + iq + home > 20:
#         print("总点数超过了 20!")
#         continue
#     print("初始属性设定完成!")
#     break
# point = random.randint(1, 6) # 掷色子
# if point % 2 == 1:
#     gender = 'boy'
#     print("你是个男孩")
# else:
#     gender = 'girl'
#     print("你是个女孩")
#
# point = random.randint(1, 3) # 掷色子
# if home == 10:
#     print('你出生在帝都, 你的父母是高官政要')
#     home += 1
#     iq += 1
#     face += 1
# elif 7 <= home <= 9:
#     if point == 1:
#         print('你出生在大城市, 你的父母是公务员')
#         face += 2
#     elif point == 2:
#         print('你出生在大城市, 你的父母是大企业高管')
#         home += 2
#     else:
#         print('你出生在大城市, 你的父母是大学教授')
#         iq += 2
# elif 4 <= home <= 6:
#     if point == 1:
#         print('你出生在三线城市, 你的父母是教师')
#         iq += 1
#     elif point == 2:
#         print('你出生在镇上, 你的父母是医生')
#         strong += 1
#     else:
#         print("你出生在镇上, 你的父母是个体户")
#         home += 1
# else:
#     if 1 <= point <= 2:
#         print('你出生在村里, 你的父母是辛苦劳作的农民')
#         strong += 1
#         face -= 2
#     elif 3 <= point <= 4:
#         print('你出生在穷乡僻壤, 你的父母是无业游民')
#         home -= 1
#     else:
#         print('你出生在镇上, 你父母感情不和')
#         strong -= 1
#
# for age in range(1, 11):
#     info = f'你今年 {age} 岁, '
#     point = random.randint(1, 3)
#     # 性别触发事件
#     if gender == 'girl' and home <= 3 and point == 1:
#         info += '你家里人重男轻女思想非常严重, 你被遗弃了!'
#         print(info)
#         print("游戏结束!")
#         sys.exit(0)
#     # 体质触发的事件
#     elif strong < 6 and point != 3:
#         info += '你生了一场病, '
#         if home >= 5:
#             info += '在父母的精心照料下恢复了健康'
#             strong += 1
#             home -= 1
#         else:
#             info += '你的父母没精力管你, 你的身体状况更糟糕了'
#             strong -= 1
#  # 颜值触发的事件
#     elif face < 4 and age >= 7:
#         info += '你因为长的太丑, 别的小朋友不喜欢你, '
#         if iq > 5:
#             info += '你决定用学习填充自己'
#             iq += 1
#         else:
#             if gender == 'boy':
#                 info += '你和别的小朋友经常打架'
#                 iq -= 1
#                 strong += 1
#             else:
#                 info += '你经常被别的小朋友欺负'
#                 strong -= 1
#     # 智商触发的事件
#     elif iq < 5:
#         info += '你看起来傻傻的, '
#         if home >= 8 and age >= 6:
#             info += '你的父母给你送到更好的学校学习'
#         elif 4 <= home <= 7:
#             if gender == 'boy':
#                 info += '你的父母鼓励你多运动, 加强身体素质'
#                 strong += 1
#             else:
#                 info += '你的父母鼓励你多打扮自己'
#                 face += 1
#         else:
#             info += '你的父母为此经常吵架'
#             if point == 1:
#                 strong -= 1
#             elif point == 2:
#                 iq -= 1
#  # 健康成长
#     else:
#         info += '你健康成长, '
#         if point == 1:
#             info += '看起来更聪明了'
#             iq += 1
#         elif point == 2:
#             info += '看起来更好看了'
#             face += 1
#         else:
#             info += '看起来更结实了'
#             strong += 1
#     print('-------------------------------------------')
#     print(info)
#     print(f'strong={strong}, face={face}, iq={iq}, home={home}')
#     time.sleep(1)
# print("1")
# print("2")
# print("3")
# sum=0
# count=0
# while True:
#     num=input("请输入数字：")
#     if num==';':
#         break
#     num=float(num)
#     sum+=num
#     count+=1
# print(sum/count)

# print(1 + 2 - 3)
# print(1 + 2 * 3)
# print(1 + 2 / 3)
# for i in range(1,6):
#     if i==3:
#         break
#     print(f"吃完第{i}个包子")
# for i in range(1,6):
#     if i ==3:
#         continue
#     print(f"吃完第{i}个包子")
# sum=0
# for i in range(1,101):
#     sum+=i
# print(sum)
# for i in range(10, 0, -1):
#     print(i)
# for i in range(2, 12, 2):
#     print(i)
# for i in range(1, 11):
#     print(i)
# num = 1
# sum = 0
# while num <= 5:
#     factorResult = 1
#     i = 1
#     while i <= num:
#         factorResult *= i
#         i += 1
#     sum += factorResult
#     num += 1
# print(sum)
# result = 1
# n = 1
# while n <= 5:
#     result *= n
#     n += 1
# print(result)
# sum = 0
# num = 1
# while num <= 100:
#     sum += num
#     num += 1
# print(sum)
# num = 1
# while num <= 10:
#     print(num)
#     num += 1
# a = int(input("请输入一个整数:"))
# if a != 1:
#
# else:
#     print("hello")
# a = int(input("请输入一个整数:"))
# if a != 1:
#     pass
# else:
#     print("hello")
# a = int(input("请输入一个整数:"))
# if a == 1:
#  print("hello")
# year=input("请输入年份：")
# year=int(year)
# if(year%100!=0 and year%4==0)or(year%400):
#     print("闰年")
# else:
#     print("平年")
# a=input("请输入一个整数：")
# a=int(a)
# if a>0:
#     print("正数")
# elif a<0:
#     print("负数")
# else:
#     print("为0")

# a=input("请输入一个整数：")
# a=int(a)
# if a%2==0:
#     print("偶数")
# else:
#     print("奇数")
# if a == 1:
#     if b == 2:
#         if c == 3:
#             if d == 4:
#                 if e == 5:
#                     if f == 6:
#                         if g == 7:
#                             print("hello")
#                         print("1")
#             print("2")
# a = input("请输入第一个整数: ")
# b = input("请输入第二个整数: ")
# if a == "1":
#     if b == "2":
#         print("hello")
#     print("world")
# print("python")

# a=input("请输入一个整数：")
# if a=="1":
#     print("hello")
#     print("world1")
# print("world2")

# choice=input("输入1表示认真学习，输入2表示躺平摆烂：")
# if choice=="1":
#     print("你会找到好工作")
# elif choice=="2":
#     print("你可能毕业就失业了！")
# else:
#     print("你的输入有误")


# print("1")
# print("2")
# print("3")
